package top.mayyd.customerdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class CustomerDemoApplication {

    public static void main(String[] args) {
        SpringApplication.run(CustomerDemoApplication.class, args);
    }

    //注册一个 RestTemplate
    @Bean
    public RestTemplate restTemplate() {
        //这里使用的是 OkHttp 客户端，只需要注入工厂即可。另外需要添加对应的依赖。
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }
}
